package cn.tedu.sprig.dibase;

import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class BookTest {
    @Test
    public void setTest(){
        Book book =new Book();
        book.setBookName("花千骨");
        book.setBookAuthor("赵丽颖");
        System.out.println("book = "+book);
    }

    @Test
    public void ConsTest(){
        Book book = new Book("杉杉来了","赵丽颖");
        System.out.println("book="+book);
    }

    @Test
    public void SpringSetTest(){
        ApplicationContext context = new ClassPathXmlApplicationContext("bean-di.xml");
        Book book = context.getBean("book",Book.class);
        System.out.println("book="+book);
    }

    @Test
    public void SpringConsTest(){
        ApplicationContext context = new ClassPathXmlApplicationContext("bean-di.xml");
        Book book = context.getBean("bookCons",Book.class);
        System.out.println("book="+book);
    }
}
